package com.tianbao54.dubbo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.tianbao54.dubbo.provider.HelloService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {

    @Reference(//version = "2.0.0", // 指定版本访问
            version = "*", // 随机访问
            application = "${dubbo.application.id}")
    private HelloService helloService;

    @RequestMapping("/sayHello")
    public String sayHello(@RequestParam String name) {
        return helloService.sayHello(name);
    }
}
